package com.example.thethirdcodepractice

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.Toast

class FirstActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_first)
    }

    override fun onCreateOptionsMenu(menu: Menu?): Boolean {
        menuInflater.inflate(R.menu.main, menu)
        return true
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        when(item.itemId) {
            R.id.add_item -> {
                Toast.makeText(this, "You clicked Add", Toast.LENGTH_SHORT).show()
            }
            R.id.remove_item -> {
                Toast.makeText(this, "You clicked Remove", Toast.LENGTH_SHORT).show()
            }
        }
        return true
    }
}
